<template>
  <div class="app-container">
    <el-form ref="list" :inline="true" :model="list" label-width="130px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="用户姓名">{{ list.userName }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="用户手机号">{{ list.userPhone }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="术后/术前">
            <div class="img">
              <img v-for="(item, index) in list.imgBeforeList" :key="index" :src="img+item" alt>
            </div>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="分期术后">
            <div class="img">
              <img v-for="(item, index) in list.imgAfterList" :key="index" :src="img+item" alt>
            </div>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="流水单备注">{{ list.waterRemark }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="补贴单备注">{{ list.allowanceRemark }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="审核状态">
            <el-radio-group v-model="list.img6Handle">
              <el-radio :label="2">审核通过</el-radio>
              <el-radio :label="3">审核驳回</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="原因">
            <el-input
              v-model="list.uploadRemark"
              type="textarea"
              :rows="2"
              placeholder="不通过原因，会发短信告知用户"
            />
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item>
            <el-button
              :disabled="!this.list.img6Handle"
              style="margin-top:30px;margin-left:130px"
              type="primary"
              @click="subime"
            >立即提交</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
import pictureaudit from '@/api/pictureaudit/pictureaudit'
export default {
  data() {
    return {
      list: {},
      id: 0,
      img: localStorage.getItem('imgUrlPrefix')
    }
  },
  mounted() {
    this.id = this.$route.query.id ? this.$route.query.id - 0 : 0
    this.detail()
  },
  methods: {
    subime() {
      pictureaudit.update(this.list).then(res => {
        if (res.data.code == 0) {
          this.$router.go(-1) // 返回上一层
        } else {
          this.$message.error(res.data.msg)
        }
      })
    },
    detail() {
      if (this.id) {
        pictureaudit.detail({ id: this.id }).then(res => {
          if (res.data.code == 0) {
            this.list = res.data.data
          } else {
            this.$message.error(res.data.msg)
          }
        })
      }
    }
  }
}
</script>
<style scoped>
.img {
  display: flex;
}
img {
  width: 50%;
  display: inline-block;
}
</style>
